﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once

#include "IGraphicsNode.h"

namespace gcmp
{
    class IGraphicsCurve3d;
    class IGraphicsBRepBody;
    class IGraphicsBRepFace;
    class IEdge;

    /// \brief BRep边图形节点
    ///
    /// 表示体的一个边，不能脱离体存在
    class GCMP_GRAPHICS_NODE_INTERFACE_EXPORT IGraphicsBRepEdge : public IGraphicsNode
    {
        DEFINE_CAST_DERIVED(IGraphicsBRepEdge, IGraphicsNode)
   
    public:
        /// \brief 析构器
        virtual ~IGraphicsBRepEdge();

public:

        /// \brief 获取是否是直线边
        /// \return true-是；false-否
        virtual bool IsStraightLine() const = 0;

        /// \brief 获取边对应的三维曲线图形节点
        /// \return 边对应的三维曲线图形节点
        virtual OwnerPtr<IGraphicsCurve3d> GetGeometryCurve() const = 0;

        /// \brief 获取边相邻的面图形节点集合
        /// \return 边相邻的面图形节点集合
        /// \see IGraphicsBRepFace
        virtual std::vector<const IGraphicsBRepFace*> GetFaces() const = 0;
        
        /// \brief 获取边的起点坐标
        /// \return 边的起点坐标
        virtual Vector3d GetStartPoint() const = 0;

        /// \brief 获取边的终点坐标
        /// \return 边的终点坐标
        virtual Vector3d GetEndPoint() const = 0;
 
    public:
        /// \brief 获取几何边
        /// \return 几何边
        virtual const IEdge* GetGmEdge() const = 0;

        /// \brief 获取几何边
        /// \return 几何边
        virtual IEdge* GetGmEdgeFW() = 0;

        /// \brief 获取边所属的体图形节点
        /// \return 边所属的体图形节点
        virtual const IGraphicsBRepBody* GetBRepBody() const = 0;

        /// \brief 设置几何边
        /// \param pEdge 几何边
        /// \return 无
        virtual void SetEdge(const IEdge* pEdge) = 0;

        /// \brief 克隆边图形节点
        ///
        /// 其中的几何边替换成目标体中相应位置的目标几何边
        /// \param pGBody 目标体
        /// \param pEdge 目标几何边
        /// \return 克隆出来的图形节点
        virtual OwnerPtr<IGraphicsNode> Clone(const IGraphicsBRepBody* pGBody, const IEdge* pEdge) const = 0;

        /// \brief 获取调试信息
        /// \return 调试信息
        virtual std::wstring GetStringForDebug()const = 0;

        /// \brief 获取是否是面的接缝边
        /// \return true-是；false-否
        virtual bool IsSeam() const = 0;

    public:
        /// \brief 根据几何边以及它所属的BRep体图形节点来创建BRep边图形节点
        /// \param pBody BRep体图形节点
        /// \param pEdge 几何边
        /// \return 创建的BRep边图形节点
        static OwnerPtr<IGraphicsBRepEdge> Create(const IGraphicsBRepBody* pBody, const IEdge* pEdge);
    };
}


